package com.woniuxy.service.impl;

import com.woniuxy.dao.AttendanceDao;
import com.woniuxy.entity.Attendance;
import com.woniuxy.entity.PageBean;
import com.woniuxy.service.AttendanceService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
@Slf4j
public class AttendanceServiceImpl implements AttendanceService {

  @Autowired
  AttendanceDao attendanceDao;
    @Override
    public PageBean<Attendance> getAllAttendance(Attendance attendance, int pageIndex, int pageSize) {

      PageBean<Attendance>pageBean=new PageBean<>();
      pageBean.setPageIndex(pageIndex);
      pageBean.setPageSize(pageSize);
        int pageCount = attendanceDao.selectAttendanceCount(attendance);
pageBean.setTotalRecord(pageCount);
pageBean.setBeanList(attendanceDao.selectAllAttendance(attendance, pageIndex, pageSize));

        return pageBean;
    }
}
